import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.event.ListSelectionListener;
public class Manual extends JFrame{
	int x = 0;
	int y = 0;
	private ImageIcon[] man = { new ImageIcon("Man0.jpg"), new ImageIcon("Man1.jpg"), new ImageIcon("Man2.jpg"),
								new ImageIcon("Man3.jpg"), new ImageIcon("Man4.jpg"), new ImageIcon("Man5.jpg"),
								new ImageIcon("Man6.jpg"), new ImageIcon("Man7.jpg")};
	private ImageIcon[] XD = {new ImageIcon("ManP.jpg"), new ImageIcon("ManN.jpg")};
	private JButton prev, nex;
	private JLabel d, f;
	public Manual(){
		super("Manual");
		
		Container c = getContentPane();
		c.setLayout(null);
		
		d = new JLabel(man[0]);
		d.setSize(1000, 550);
		d.setLocation(0,0);
		c.add(d);
		
		f = new JLabel("You are currently  at page 1");
		f.setSize(600, 50);
		f.setLocation(200, 550);
		c.add(f);
		
		prev = new JButton(XD[0]);
		prev.setToolTipText("See previous page");
		prev.setCursor(new Cursor(Cursor.HAND_CURSOR));
		prev.setSize(200, 50);
		prev.setLocation(0, 550);
		prev.addActionListener(
			new ActionListener(){
				public void actionPerformed(ActionEvent e){
					if(x==0){
						x = x;
					}
					else if(x>0){
						x = (x-1) % 8;
					}
					y = x + 1;
					d.setIcon(man[x]);
					f.setText("You are currently at page " +y);
					repaint();
				}
			}
			);
		c.add(prev);
		
		nex = new JButton(XD[1]);
		nex.setToolTipText("See next page");
		nex.setCursor(new Cursor(Cursor.HAND_CURSOR));
		nex.setSize(200, 50);
		nex.setLocation(800, 550);
		nex.addActionListener(
			new ActionListener(){
				public void	actionPerformed(ActionEvent e){
					if(x==7){
						x = x;
					}
					else if(x<7){
						x = (x+1) % 8;
					}
					y = x + 1;
					d.setIcon(man[x]);
					f.setText("You are currently at page " +y);
					repaint();
					}		
				}
			);
		c.add(nex);
		setSize(1000, 600);
		setVisible(true);
		setResizable(false);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
	}
}